Skip to main content

6.2 Micro XRCE-DDS

In order for ROS 2 to communicate with PX4, the uXRCE-DDS Client must be running on the PX4 and connected to the Micro XRCE-DDS Agent running on the companion computer, the RDK X5 Module.

Micro XRCE-DDS Client

The PX4 uxrce_dds_client is generated at build time and included by default in the PX4 firmware; no additional installation is required.

Micro XRCE-DDS Agent

The Micro XRCE-DDS Agent can be installed on a companion machine using a binary package, built and installed from source code, or built and run within a ROS 2 workspace. All of these methods will get all the dependencies needed to communicate with the client (such as FastCDR).

Installing the standalone

On Ubuntu, you can build the Agent standalone version from source and install it using the following command:

git clone -b v2.4.2 https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
cd Micro-XRCE-DDS-Agent
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig /usr/local/lib/

To start the proxy and set up a connection to the uXRCE-DDS client running on the emulator:

MicroXRCEAgent udp4 -p 8888

from Snap package

Install from the snap package on Ubuntu using the following command:

sudo snap install micro-xrce-dds-agent --edge

To start the agent, use the settings that connect to the uXRCE-DDS client running on the emulator (note that the command names are different when you build the agent locally):

micro-xrce-dds-agent udp4 -p 8888

Building/

You can build and launch the agent within a ROS 2 workspace (or build it standalone and launch it from a workspace). You must have already installed ROS 2 as described in the ROS 2 User Guide > Installing ROS 2.

To build an agent in ROS:

  1. Create a workspace directory for the agent:
    mkdir -p ~/px4_ros_uxrce_dds_ws/src
  2. Clone the source code of eProsima Micro-XRCE-DDS-Agent to /src the directory ( main default clone branch):
    cd ~/px4_ros_uxrce_dds_ws/src
    git clone -b v2.4.2 https://github.com/eProsima/Micro-XRCE-DDS-Agent.git
  3. Get the ROS 2 development environment and compile the workspace using the following commands colcon:
    source /opt/ros/humble/setup.bash
    colcon build
    /src This will build all folders under it using the source toolchain.

To run the Micro XRCE-DDS Agent in a workspace:

  1. Provide the source local_setup.bash to make the executable available in the terminal (even if setup.bash using a new terminal).
    source /opt/ros/humble/setup.bash
    source install/local_setup.bash
  2. Start the agent with settings that connect to the uXRCE-DDS client running on the emulator:
    MicroXRCEAgent udp4 -p 8888